function throttle(callback, wait) {
  let old = 0;
  return function(...args) {
    let now = Date.now();
    if (now - old > wait) {
      callback.apply(this, args)
      old = now;
    }
  }
}